/**
 * Auxiliar.java
 * Copyright (C) 2009 Jose Mauro da Silva Sandy
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

package utils;

import javax.swing.SwingConstants;
import javax.swing.table.DefaultTableCellRenderer;

/**
 *
 * @author jmsandy
 */
public class Auxiliar {

    //<editor-fold defaultstate="collapsed" desc="Constants">
    public static final int CENTER = 1;
    public static final int RIGHT  = 2;
    public static final int LEFT   = 4;

    /**
     * Realiza o alinhamento de um dado campo
     * @param align alinhamento a ser efetuado
     * @return o alinhamento para ser setado no renderer
     */
    public static DefaultTableCellRenderer getAlign(int align){
        DefaultTableCellRenderer tAlign = new DefaultTableCellRenderer();

        // Verifica qual sera o alinhamento de retorno
        switch(align){
            case CENTER:{
                tAlign.setHorizontalAlignment(SwingConstants.CENTER); break;
            }
            case RIGHT:{
                tAlign.setHorizontalAlignment(SwingConstants.RIGHT); break;
            }
            default:{
                tAlign.setHorizontalAlignment(SwingConstants.LEFT); break;
            }
        }
        return tAlign;
    }
    //</editor-fold>

    /**
     * Responsavel por pegar o token responsavel por informar ao sistema qual 
     * SO esta em execucao para concatenacao de caminhos.
     * @return token para concatenacao de caminho no sistema
     */
    public static String getTokenSO(){
        String token = null;

        // Verifica qual o sistema operacional que esta sendo executado
        if(System.getProperty("os.name").contains("WINDOWS")) token = "\\";
        else token = "/";
        
        return token;
    }
}
